#pragma once


#include "MysqlDao.h"

class MysqlManager : public Singleton<MysqlManager>
{
	friend class Singleton<MysqlManager>;

public:
	~MysqlManager();

	int regUser(const std::string& name, const std::string& email, const std::string& pwd, const std::string& icon);
	bool checkEmail(const std::string& name, const std::string& email);
	bool updatePwd(const std::string& name, const std::string& pwd);
	bool checkPwd(const std::string& name, const std::string& pwd, UserInfo& userInfo);
	bool addFriendApply(const int& from, const int& to);
	bool getApplyList(int touid, std::vector<std::shared_ptr<ApplyInfo>>& applyList, int begin, int limit = 10);
	bool getFriendList(int self_id, std::vector<std::shared_ptr<UserInfo> >& user_info_list);
	bool authFriendApply(const int& from, const int& to);
	bool addFriend(const int& from, const int& to, std::string back_name);
	bool authFriendApplyAndAddFriend(const int& from, const int& to, std::string back_name);
	std::shared_ptr<UserInfo> getUserInfo(int uid);
	std::shared_ptr<UserInfo> getUserInfo(std::string name);

private:
	MysqlManager() = default;

public:
	MysqlDao m_dao;
};

